<template>
  <div class="custom-header-c" :style="wrapStyle">
    <div class="left-c">
      <wd-icon name="thin-arrow-left" size="18px" />
    </div>
    <div class="center-c">
      <slot>
        {{ title }}
      </slot>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { useSystemStore } from '@/store'

// 定义 defineProps 属性title: string
const props = withDefaults(
  defineProps<{
    title: string
    showLeft: boolean
    showRight: boolean
  }>(),
  {
    title: '',
    showLeft: true,
    showRight: true
  }
)
/* 处理组件高度和边距 */
const systemStore = useSystemStore()
const capsuleInfo = systemStore.navigationBarInfo
const systemInfo = systemStore.systemInfo
const wrapStyle = {
  paddingTop: `${systemInfo.statusBarHeight}px`,
  height: `${capsuleInfo.bottom + 4}px`
}
const contentStyle = {
  width: `${systemInfo.screenWidth - capsuleInfo.left}px`,
  height: '1px'
}
onMounted(() => {})
</script>

<style scoped lang="scss">
.custom-header-c {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  .center-c {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>
